/*
 ============================================================================
 Name		: Record.cpp
 Author	  : zhujiao
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CRecord implementation
 ============================================================================
 */

#include "Record.h"

CRecord::CRecord()
	{
	// No implementation required
	}

CRecord::~CRecord()
	{
	}

TDesC* CRecord::TransferToBuf()
	{
	TBuf<256> rowText;


	rowText.Zero();
	//rowText.Append(_L("."));	
	TInt num;
	TLex lex0(year);
	lex0.Val(num);
	if(num<10&&num>0)	rowText.Append(_L("0"));
	rowText.Append(year);
	
	rowText.Append(_L("/"));
	
	TLex lex1(month);
	lex1.Val(num);
	if(num<10&&num>0)	rowText.Append(_L("0"));
	rowText.Append(month);
	
	rowText.Append(_L("/"));
	
	TLex lex2(day);
	lex2.Val(num);
	if(num<10&&num>0)
	rowText.Append(_L("0"));
	rowText.Append(day);
	
	rowText.Append(_L(" "));
	rowText.Append(place);
	rowText.Append(_L(" "));
	rowText.Append(type);
	rowText.Append(_L(" "));
	rowText.Append(money);
	rowText.Append(_L(" "));	
	rowText.Append(remark);
	return &rowText;
	}

CRecord* CRecord::NewLC()
	{
	CRecord* self = new (ELeave) CRecord();
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

CRecord* CRecord::NewL()
	{
	CRecord* self = CRecord::NewLC();
	CleanupStack::Pop(); // self;
	return self;
	}

void CRecord::ConstructL()
	{

	}
TInt CRecord::ChangeMoneyToInt()
	{
	TLex lex(money);
	TInt money0;
	lex.Val(money0);
	return money0;
	}
TBool CRecord::ChangeDateToIntAndJudge(TInt year1,TInt month1,TInt day1,TInt year2,TInt month2,TInt day2)
	{
	TLex lex1(year);
	TInt year0;
	lex1.Val(year0);
	
	TLex lex2(month);
	TInt month0;
	lex2.Val(month0);
	
	TLex lex3(day);
	TInt day0;
	lex3.Val(day0);
	
	if(
			((year0>year1) || 
			(year0==year1 && month0>month1) ||
			((year0==year1) && (month0==month1) && day0>=day1)) &&
			((year0<year2) || 
			(year0==year2 && month0<month2) ||
			((year0==year2) && (month0==month2) && day0<=day2))
		)
		return ETrue;
	else return EFalse;
	}
